package com.powerunion.datacollection.dao;

import java.util.List;

import com.powerunion.datacollection.model.ApproveActivityInstance;
import com.powerunion.datacollection.model.ApproveWorkItem;

public interface ApproveWorkItemDao {
	public boolean initApproveWork(ApproveActivityInstance activityInfo,String formId)throws DaoException;
	
	public List findApproveWorkByUser(String userCode) throws DaoException;
	
	public boolean updateState4Act(int state,String id)throws DaoException;
	
	public boolean suspendApproveWork(String procId) throws DaoException;
	
	public boolean resumeApproveWork(String procId) throws DaoException;
	
	public List findApproveWorkIdByActivityId(String activityId)
	throws DaoException;
	
	public boolean submissionRule(String actId,String approveUserCode) throws DaoException;
	
	public boolean saveApproveInfo(ApproveWorkItem aw) throws DaoException;
	
	//public ApproveWorkItem getApproveInfo(String id) throws DaoException;
	
	public ApproveWorkItem getByKey(String id) throws DaoException;
	
	public int getActivityType(String actId) throws DaoException;
	
	public List approveInfoHistory(String actId ,int type) throws DaoException;
	
	public boolean updateState4User(int state,String id) throws DaoException;
	
	public List getSubWorkUsers(String approveWorkId ,int workItemType) throws DaoException;
	/**
	 * 隐藏除了id为approveWorkId之外的同个审批步骤中的其他审批任务
	 * @param actId 步骤id
	 * @param approveWorkId 
	 * @param preActId 
	 * @return
	 * @throws DaoException
	 */
	public boolean hideApproveWork(String actId,String approveWorkId,String preActId) throws DaoException;
	/**
	 * 
	 * @param actId
	 * @param preActId
	 * @return
	 * @throws DaoException
	 */
	public boolean hideAllApproveWork(String preActId) throws DaoException;
	/**
	 * 得到某个环节下所有的处于汇聚同步等待状态的审批任务id
	 * @param actId
	 * @return
	 * @throws DaoException
	 */
	public String getAllApproveWorkIds(String actId) throws DaoException;
	/**
	 * 判断是否所有的子节点都已经上报了数据
	 * @param actId
	 * @return
	 * @throws DaoException
	 */
	public boolean isAllSubActHaveSubmission(String actId) throws DaoException;
	
	public List findCompleteApproveWorkByUser(String userCode)
	throws DaoException ;
	
	public List findAllApproveWorkByUser(String userCode) throws DaoException;
	/**
	 * 判断该步骤是否已经提交到下一级的审批步骤
	 * @param actId
	 * @return
	 * @throws DaoException
	 */
	public boolean isSub(String actId) throws DaoException;
	/**
	 * 转发审批任务
	 * @param awi 审批任务信息
	 * @param receiveUsers 接收者
	 * @return
	 * @throws DaoException
	 */
	public boolean saveByTransmit(ApproveWorkItem awi,String receiveUsers) throws DaoException;
	
	/**
	 * 判断该审批任务是否已经提交
	 * @param id
	 * @return
	 * @throws DaoException
	 */
	public boolean iApproveWorkCommit(String id) throws DaoException;
	/**
	 * 更新某个步骤下的某个具体用户的审批任务状态
	 * (某个用户在某个审批步骤下会有多条审批任务)
	 * @param state
	 * @param actId
	 * @param userCode
	 * @return
	 * @throws DaoException
	 */
	public boolean updateState4UserCode(int state, String actId,String userCode) throws DaoException;
	
}
